//
//  Cellscoll.m
//  project-A (pianke)
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 scott. All rights reserved.
//

#import "Cellscoll.h"
#import "NetWorkingHandler.h"
#import <UIImageView+WebCache.h>
@implementation Cellscoll

-(void)dealloc{
    [_arr release];
    [_mainScollVIew release];
       [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    self.arr = [NSMutableArray array];
   
    
    NSLog(@"%@",self.arr);
    if (self) {
      
        CGFloat width = [UIScreen mainScreen].bounds.size.width;
        CGFloat height = width * 0.5;
        NSMutableArray *viewsArray = [@[] mutableCopy];
        self.arr = @[@"http://pkicdn.image.alimmdn.com/timeline/tagimgs/f1365edd488a693312e4e381defafd93.png",@"http://pkicdn.image.alimmdn.com/timeline/tagimgs/40b6da995fd984f7cfd0512750635bac.jpg",
                     @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/6eb0ec829aeabb3e724ea431dd890207.jpg",
                    @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/df4ae06d977e198670349870a816c28c.jpg",
                     @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/74e87cd13f8bf13e14bc1c9b135e4fbb.jpg",
                     @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/a4d88950b4774245f6db5759f11fca79.jpg",
                     @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/32c76c4edd8bda55c0bc61ae43931711.png",
                     @"http://pkicdn.image.alimmdn.com/timeline/tagimgs/f1365edd488a693312e4e381defafd93.png",@"http://pkicdn.image.alimmdn.com/timeline/tagimgs/40b6da995fd984f7cfd0512750635bac.jpg"].mutableCopy;
        
        NSLog(@"%@",self.arr);
        for (int i = 0; i < self.arr.count; ++i) {
            UIImageView *tempLabel = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, width,height)];
            [tempLabel sd_setImageWithURL:[NSURL URLWithString:[self.arr objectAtIndex:i]] placeholderImage:nil options:SDWebImageAvoidAutoSetImage];
            
            
            
            [viewsArray addObject:tempLabel];
        }
        
        self.mainScollVIew = [[CycleScrollView alloc] initWithFrame:CGRectMake(0,0,width,height) animationDuration:2];
        self.mainScollVIew.backgroundColor = [[UIColor purpleColor] colorWithAlphaComponent:0.1];
        
        self.mainScollVIew.fetchContentViewAtIndex = ^UIView *(NSInteger pageIndex){
            return viewsArray[pageIndex];
        };
        self.mainScollVIew.totalPagesCount = ^NSInteger(void){
            return  self.arr.count;
        };
        self.mainScollVIew.TapActionBlock = ^(NSInteger pageIndex){
            //            NSLog(@"点击了第%ld个",pageIndex);
        };
        [self addSubview:self.mainScollVIew];
        
    }
    
    return self;
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
